<template>
  <div class="taskdetails">
    <header>
      <van-nav-bar title="任务详情" left-arrow @click-left="onClickLeft" />
    </header>
    <div class="main">
      <div class="info">
        <SCollapse>
          <template #title>基本信息</template>
          <template #content>
            <div style="overflow: hidden; position: relative; height: 120px">
              <SDialog type="1" :misson="obj"></SDialog>
            </div>
            <div class="bottom">
              <ul>
                <!-- <li>
                  <div class="left">任务编号</div>
                  <div class="right">1557211886558850</div>
                </li> -->
                <li>
                  <div class="left">任务编号</div>
                  <div class="right">{{ obj.id }}</div>
                </li>
                <li>
                  <div class="left">联系人</div>
                  <div class="right">{{ obj.name }}</div>
                </li>
                <li>
                  <div class="left">联系电话</div>
                  <div class="right">
                    {{ obj.phone
                    }}<i
                      class="iconfont icon-dianhua1"
                      style="color: #ef4f3f; font-size: 20px; margin-left: 5px"
                    ></i>
                  </div>
                </li>
                <li>
                  <div class="left">提货时间</div>
                  <div class="right">{{ obj.getTime }}</div>
                </li>
                <li>
                  <div class="left">预计送达时间</div>
                  <div class="right">{{ obj.preferTime }}</div>
                </li>
              </ul>
            </div></template
          >
        </SCollapse>
        <SCollapse>
          <template #title>车辆司机信息</template>
          <template #content>
            <ul>
              <li>
                <div class="left">车牌号</div>
                <div class="right">{{ driver.carNumber }}</div>
              </li>
              <li>
                <div class="left">司机姓名</div>
                <div class="right">{{ driver.name }}</div>
              </li>
            </ul>
          </template>
        </SCollapse>
        <SCollapse>
          <template #title>运输路线</template>
          <template #content>
            <div class="road-line">
              <div class="left">
                <ul>
                  <li style="justify-content: space-around">
                    <div class="left">
                      <h4 style="line-height: 22px; font-size: 16px">北京市</h4>
                      <p style="line-height: 20px; font-size: 14px">北京市</p>
                    </div>
                    <div class="cengter">
                      <i
                        class="iconfont icon-chengshijiantou"
                        style="font-size: 36px; color: #818181"
                      ></i>
                    </div>
                    <div class="right">
                      <h4 style="line-height: 22px; font-size: 16px">河南省</h4>
                      <p style="line-height: 20px; font-size: 14px">郑州市</p>
                    </div>
                  </li>
                </ul>
              </div>
              <div
                class="right"
                @click="
                  $router.push({
                    path: '/roadmap',
                  })
                "
              >
                <div></div>
                <p>开始导航</p>
              </div>
            </div>
          </template>
        </SCollapse>
        <SCollapse>
          <template #title>物品信息</template>
        </SCollapse>
        <SCollapse class="abnormalInfo">
          <template #title>异常信息</template>
          <template #content>
            <div
              class="abnormalcontent"
              v-for="(item, index) in errMessage"
              :key="index"
            >
              <p class="time">
                上报时间<span>{{ item.time }}</span>
              </p>
              <p class="type">
                异常类型<span>{{ item.type }}</span
                ><i class="iconfont icon-youjiantou"></i>
              </p>
              <p class="result">
                处理结果<span>{{ item.result }}</span>
              </p>
            </div>
          </template>
        </SCollapse>
        <SCollapse class="DeliveryInfo">
          <template #title>交货信息</template>
          <template #content>
            <p>请拍照上传回单凭证</p>
            <van-uploader
              v-model="fileList"
              multiple
              :preview-full-image="true"
            />
            <p>请拍照上传货品照片</p>
            <van-uploader
              v-model="fileList2"
              multiple
              :preview-full-image="true"
            />
          </template>
        </SCollapse>
      </div>
    </div>
    <footer>
      <button class="delay" @click="$router.push('/senderr')">上报异常</button>
      <button
        class="pick"
        @click="send"
        :style="{ background: disabled ? '#FADCD9' : '#ef4f3f' }"
        :disabled="disabled"
      >
        交付
      </button>
    </footer>
  </div>
</template>
<script>
import SCollapse from "@/components/SCollapse.vue";
import SDialog from "@/components/SDialog.vue";
export default {
  name: "MissionDetail",
  components: {
    SCollapse,
    SDialog,
  },
  data() {
    return {
      toast: "0",
      disabled: false,
      activeNames: ["1"],
      obj: {
        number: "XAHH1234567",
        start: "北京市昌平区回龙观街道西三旗桥东金燕龙写字楼8877号",
        end: "河南省郑州市路北区北清路99号",
        id: "1557211886558850",
        name: "张三",
        phone: "13512345678",
        getTime: "2022.05.04 13:00",
        preferTime: "2022.05.05 10:00",
      },
      driver: {
        name: "张三",
        carNumber: "京A123456",
      },
      errMessage: [
        {
          time: "2022.05.04 13:00",
          type: "有异常响动",
          result: "继续运输",
        },
        {
          time: "2022.05.03 13:00",
          type: "照明失灵",
          result: "继续运输",
        },
      ],
      fileList: [],
      fileList2: [],
    };
  },
  created() {},
  computed: {},
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
    send() {
      setTimeout(() => {
        this.toast = "0";
      }, 2000);
    },
  },
};
</script>
<style lang='less' scoped>
header {
  padding-top: 43px;
  background-color: #fff;
  width: 100vw;
  height: 93px;
  position: fixed;
  top: 0px;
  left: 0;
  z-index: 999;
  .van-nav-bar {
    width: 100%;
    height: 100%;
    line-height: 50px;
    font-size: 25px;
    color: #000;
    /deep/.van-nav-bar__title {
      font-weight: 700;
    }
  }
}
.taskdetails {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding-top: 93px;
  background-color: #f5f5f5;
  .main {
    flex: 1;
    position: relative;
    margin-bottom: 70px;
    background-color: #f5f5f5;
    padding-bottom: 70px;
    .van-cell-group--inset {
      margin: 15px;
    }
    .DeliveryInfo {
      p {
        margin: 15px 0;
        font-size: 14px;
        line-height: 20px;
        color: #818181;
      }
    }
    .abnormalInfo {
      .abnormalcontent {
        border-bottom: 1px dashed #ccc;
        margin-bottom: 20px;
        p {
          margin-bottom: 18px;
          font-size: 14px;
          color: #2a2929;
          span {
            margin-left: 16px;
            color: #818181;
          }
          .iconfont {
            float: right;
            width: 24px;
            height: 24px;
            line-height: 24px;
            text-align: center;
            border: 1px dashed #ccc;
          }
        }
      }
      .abnormalcontent:last-child {
        margin-bottom: 0;
        border: none;
      }
    }
    ul {
      width: 100%;
      li {
        display: flex;
        width: 100%;
        height: 34px;
        line-height: 34px;
        justify-content: space-between;
        align-items: center;
        .left {
          color: #818181;
        }
        .right {
          color: #2a2929;
        }
      }
    }
    .bottom {
      border-top: 1px solid #eeeeee;
      padding: 20px 0;
      font-size: 14px;
    }
    .item {
      margin: 0 20px;
      padding: 20px 0;
      font-size: 14px;
      .van-icon-plus {
        color: #ef4f3f;
        font-size: 18px;
      }
      .van-cell__title {
        font-weight: 550;
        font-size: 16px;
        color: #2a2929;
      }
    }
  }
  /deep/.number {
    display: none;
  }
  /deep/.dialog {
    left: -10px;
    top: -8px;
  }
  .road-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    & > .left {
      flex: 1;
    }
    & > .right {
      width: 100px;
      height: 53px;
      border-left: 1px solid #eee;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      div {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        border: 1px solid #eee;
        background: url(@/assets/btn_daohang.png) no-repeat;
        background-position: -2px -1px;
      }
      p {
        font-size: 12px;
        color: #2a2929;
      }
    }
  }
  footer {
    position: fixed;
    display: flex;
    justify-content: space-between;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: #ffffff;
    box-shadow: 0 2px 8px 0 #a2a2a240;
    padding: 10px 15px;
    font-size: 16px;
    .delay {
      width: 125px;
      height: 50px;
      background: #e6e6e6;
      border-radius: 25px;
      line-height: 50px;
    }
    .pick {
      color: #ffffff;
      width: 207px;
      height: 50px;
      background: #ef4f3f;
      border-radius: 25px;
    }
  }
  .toast {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 10%;
    background-color: #2a2929;
    width: 90px;
    height: 37px;
    background: #2a2929;
    border-radius: 10px;
    line-height: 37px;
    text-align: center;
    color: #fff;
    transition: all 0.5s;
  }
}
</style>
